package com.joekai.base_library.utils;

import android.widget.Toast;

import com.joekai.base_library.BaseApp;

/**
 * author:  JoeKai
 * date: 2022/7/1 15:22
 * content：
 */
public class ToastUtil {
    private static Toast toast;

    private static Toast buildToast() {
        if (toast == null) {
            synchronized (Toast.class) {
                if (toast == null) {
                    toast = new Toast(BaseApp.getInstance());
                }
            }
        }
        return toast;
    }

    public static void showToast(
            String content) {
        buildToast().setText(content);
        buildToast().setDuration(Toast.LENGTH_SHORT);
        buildToast().show();
    }
}
